#include <stdio.h>

int main(int argc, char const *argv[])
{
    char username[128], groupname[128], homedir[128], bash[128];
    int uid, gid;
    FILE *file = fopen("/etc/passwd", "r");
    fscanf(file, "%[^:]:x:%d:%d:%[^:]:%[^:]:%s", username, &uid, &gid, groupname, homedir, bash);
    printf("用户名: %s\n组名: %s\nUID: %d\nGID: %d\n", username, groupname, uid, gid);

    fclose(file);
    return 0;
}
